#include "log.h"

int ccw_dbg_log_i(ccw_str tag, const ccw_str fmt, ...)
#if LOG_LEVEL <= LOG_LEVEL_INFO
{
    va_list ap;
    char buff[128] = {0};
    va_start(ap, fmt);
    vsnprintf (buff, 128, fmt, ap);
    va_end(ap);
    return printf ("[%s][INFO]: %s\r\n", tag, buff);
}
#else
{
    return 0;
}
#endif


#if LOG_LEVEL <= LOG_LEVEL_INFO
int ccw_dbg_log_d(ccw_str tag, const ccw_str fmt, ...)
{
    va_list ap;
    char buff[128] = {0};
    va_start(ap, fmt);
    vsnprintf (buff, 128, fmt, ap);
    va_end(ap);
    return printf ("[%s][DEBUG]: %s\r\n", tag, buff);

}
#else
{
    return 0;
}
#endif

#if LOG_LEVEL <= LOG_LEVEL_INFO
int ccw_dbg_log_w(ccw_str tag, const ccw_str fmt, ...)
{
    va_list ap;
    char buff[128] = {0};
    va_start(ap, fmt);
    vsnprintf (buff, 128, fmt, ap);
    va_end(ap);
    return printf ("[%s][WARN]: %s\r\n", tag, buff);

}
#else
{
    return 0;
}
#endif

#if LOG_LEVEL <= LOG_LEVEL_INFO
int ccw_dbg_log_e(ccw_str tag, const ccw_str fmt, ...)
{
    va_list ap;
    char buff[128] = {0};
    va_start(ap, fmt);
    vsnprintf (buff, 128, fmt, ap);
    va_end(ap);
    return printf ("[%s][ERROR]: %s\r\n", tag, buff);
}
#else
{
    return 0;
}
#endif




